#include<iostream>
#include<cstring> 
#include<algorithm>
using namespace std;
char s[10005];
int main(){
	int len,r=0,g=0,b=0;
	scanf("%s",s);
	len = strlen(s);
	sort(s,s+len);
	printf("%s\n",s);
	
	for(int i=0;i<len;i++){
		if(s[i] == 'R'){
			r++;
		}else if(s[i] == 'G'){
			g++;
		}else{
			b++;
		}
	}
	printf("%d\n",min(r,min(g/2,b/3)));
	return 0;
} 
